using System;
using System.Threading;

using Dashboard;
using Dashboard.Util;
using Dashboard.Engine;

namespace Dashboard.Latte
{
	public class Driver
	{
		public static void Main (string [] args)
		{
			SystemInformation.SetProcessName ("dashboard-latte");

			Gnome.Program program = new Gnome.Program ("Latte", "0.0.1", Gnome.Modules.UI, args);
		       
			ThreadAssist.Initialize ();

			// FIXME: We should add some way for the client 
			// to connect to the engine over any of the 
			// transports.

			// Initialize the engine. 

			Dashboard.Engine.Engine.Initialize ();

			Latte latte = new Latte ();
			latte.Destroyed += delegate {
				Dashboard.Engine.Engine.Dispose ();
				program.Quit ();
			};

			//Spring spring = new Spring ();
			//spring.Toggled += delegate { 
			//	if (latte.Visible)
			//		latte.Hide ();
			//	else
			//		latte.ShowAll ();
			//};
			//spring.ShowAll ();

			latte.ShowAll ();
		
			program.Run ();
		}
	}
}
